package com.ruoyi.utils;

import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.enterprise.domain.ComHot;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import java.util.List;

public class UserUtils {

    /**
     * @return 获取角色名
     */
    public static boolean isAdmin(LoginUser loginUser) {
        // 获取角色名
        List<SysRole> roleName = loginUser.getUser().getRoles();
        for (SysRole sysRole : roleName) {
            if (sysRole.isAdmin()) {
                return true;
            }
        }
        return false;
    }
}
